 const {
  queryAll,
  updateData,
} = require('../service/price')
const { SuccessModel, ErrorModel } = require('../model/ResModel')
const {
  queryFailInfo,
} = require('../model/ErrorInfo')


/**
 * 查询所有信息
 */
async function query({ page, pageSize }) {
  try {
    const result = await queryAll({ page, pageSize })
    return new SuccessModel(result)
  } catch (ex) {
    return new ErrorModel(queryFailInfo)
  }
}
/**
 * 修改信息
 */
async function update(params, id) {
  try {
    await updateData(params, id)
    return new SuccessModel(params)
  } catch (ex) {
    return new ErrorModel({})
  }
}


module.exports = {
  update,
  query
}
